package com.tjnu.losca.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tjnu.losca.core.ResponseVO;
import com.tjnu.losca.pojo.Stulog;
import com.tjnu.losca.service.IStulogService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author losca
 * @since 2021-10-29
 */
@RestController
@RequestMapping("/stulog")
public class StulogController {
    @Resource
    IStulogService stulogService;
    @GetMapping("/list")
    IPage<Stulog> list(){
        IPage<Stulog> page= stulogService.page(new Page<>(1,8));
        return page;

    }
    @GetMapping("/getStulogById")
    public ResponseVO<Stulog> getStulogById(Integer id) {
        return ResponseVO.success("成功", stulogService.getById(id));
    }
    @PostMapping("/save")
    boolean save(Stulog stulog){
        return stulogService.saveOrUpdate(stulog);
    }

}
